package cn.yunhe.entity;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "t_news")
public class News implements Serializable {

    private int id;
    private String title;
    private String context;
    private String writeTime;
    private Block block;
    private Admin admin;


    public News() {
    }

    public News(String title, String context, String writeTime) {
        this.title = title;
        this.context = context;
        this.writeTime = writeTime;
    }

    @Id
    @GeneratedValue
    @Column(name = "newsid")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name = "title")
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Column(name = "context")
    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    @Column(name = "writetime")
    public String getWriteTime() {
        return writeTime;
    }

    public void setWriteTime(String writeTime) {
        this.writeTime = writeTime;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "blockid")
    public Block getBlock() {
        return block;
    }

    public void setBlock(Block block) {
        this.block = block;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "adminid")
    public Admin getAdmin() {
        return admin;
    }

    public void setAdmin(Admin admin) {
        this.admin = admin;
    }
}
